
** Replication code for Higashijima, Masaaki and Yujin Woo. "Political Regimes and Refugee Entries: The Preferences and Decisions of Displaced Persons and Host Governments." International Studies Quarterly 

* Dyad Data  

*zero-truncated model 

* Model 4
#delimit 
ztnb ref_group_size c.polity2_v_neigh_recode2##c.polity2_v_neigh_recode2 yearswithrefugees
i.ccode_coo i.ccode_neigh i.year if ref_group_size>0, cluster(coo_neigh_year) nolog; 

#delimit cr; 
*compute BIC
estat ic 

* Logit part of Model 4 (to predict what contributes to more than 1 entry of refugee)

#delimit 
logit refs_flag c.polity2_v_neigh_recode2##c.polity2_v_neigh_recode2
norefyrs _spline1 _spline2 _spline3, cluster(coo_neigh_year) nolog; 
#delimit cr; 

*Descriptive stat (appendix a, based on the logit model above)

#delimit 
summarize ref_group_size polity2_v_neigh_recode vdem_polyarchy100_neigh tek_link_flag size_tek_group distance_ln
D_xpolity3 D_gdp_ln_lag D_lexclpop bdeadhig_ln civiliandeaths all_incidence_flag_lag tek_incidence_flag_lag yearswithrefugees 
refs_flag norefyrs if e(sample); 

#delimit cr; 


* Model 5
#delimit 
ztnb ref_group_size c.polity2_v_neigh_recode2##c.polity2_v_neigh_recode2 tek_link_flag size_tek_group distance_ln
D_xpolity3 D_gdp_ln_lag D_lexclpop bdeadhig_ln civiliandeaths all_incidence_flag_lag tek_incidence_flag_lag yearswithrefugees 
i.ccode_coo i.ccode_neigh i.year if ref_group_size>0, exposure(pop_ln) cluster(coo_neigh_year) nolog; 

#delimit cr; 
estat ic

* Lower-left in Figure 3
margins, at(polity2_v_neigh_recode2=(0 (1) 20)) atmeans
marginsplot, title ("POLITY (Dyad)", color(black)) graphregion(fcolor(white)) plotregion(fcolor(white)) addplot(histogram polity2_v_neigh_recode2 if e(sample)==1, fcolor(none) lcolor(gs11) yscale(alt) yaxis(2) legend(off))  xlabel(none) ciopts(lcolor(black) lpattern(dash)) recastci(rline) recast(line)	

* Model 6
#delimit 
ztnb ref_group_size c.vdem_polyarchy100_neigh##c.vdem_polyarchy100_neigh tek_link_flag size_tek_group distance_ln
D_xpolity3 D_gdp_ln_lag D_lexclpop bdeadhig_ln civiliandeaths all_incidence_flag_lag
tek_incidence_flag_lag yearswithrefugees
i.ccode_coo i.ccode_neigh i.year if ref_group_size>0, exposure(pop_ln) cluster(coo_neigh_year) nolog; 

#delimit cr;
estat ic


* Lower-right in Figure 3
margins, at(vdem_polyarchy100_neigh=(0(5)100)) atmeans
marginsplot, title ("V-Dem (Dyad)", color(black)) graphregion(fcolor(white)) plotregion(fcolor(white)) addplot(histogram vdem_polyarchy100_neigh if e(sample)==1, fcolor(none) lcolor(gs11) yscale(alt) yaxis(2) legend(off))  xlabel(none) ciopts(lcolor(black) lpattern(dash)) recastci(rline) recast(line)	

